package com.song.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.song.po.Student;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface StudentDao extends BaseMapper<Student> {


   /**
    * 查询所有
    * @return
    */
   @Select("select * from t_student" +
       " inner join t_netClass on fk_netClass_id = netClass_id" +
       " inner join t_room on fk_room_id = room_id")
   @ResultMap("com.song.dao.StudentDao.studentMap")
   List<Student> getALLStudentList();

   /**
    * 条件查询
    * @param queryWrapper
    * @return
    */
   @Select("select * from t_student" +
       " inner join t_netClass on fk_netClass_id = netClass_id" +
       " inner join t_room on fk_room_id = room_id" +
       " ${ew.customSqlSegment}")
   @ResultMap("com.song.dao.StudentDao.studentMap")
   List<Student> getStudentsByWrapper(@Param(Constants.WRAPPER) QueryWrapper<Student> queryWrapper);
}
